/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidad;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author a
 */
@Entity
@Table(name = "comanda")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Comanda.findAll", query = "SELECT c FROM Comanda c"),
    @NamedQuery(name = "Comanda.findByIdComanda", query = "SELECT c FROM Comanda c WHERE c.idComanda = :idComanda"),
    @NamedQuery(name = "Comanda.findByNumero", query = "SELECT c FROM Comanda c WHERE c.numero = :numero"),
    @NamedQuery(name = "Comanda.findByFechaIngreso", query = "SELECT c FROM Comanda c WHERE c.fechaIngreso = :fechaIngreso"),
    @NamedQuery(name = "Comanda.findByTarjeta", query = "SELECT c FROM Comanda c WHERE c.tarjeta = :tarjeta"),
    @NamedQuery(name = "Comanda.findByEfectivo", query = "SELECT c FROM Comanda c WHERE c.efectivo = :efectivo"),
    @NamedQuery(name = "Comanda.findByDescuento", query = "SELECT c FROM Comanda c WHERE c.descuento = :descuento"),
    @NamedQuery(name = "Comanda.findByDescripcion", query = "SELECT c FROM Comanda c WHERE c.descripcion = :descripcion"),
    @NamedQuery(name = "Comanda.findByTotal", query = "SELECT c FROM Comanda c WHERE c.total = :total"),
    @NamedQuery(name = "Comanda.findByAnulado", query = "SELECT c FROM Comanda c WHERE c.anulado = :anulado")})
public class Comanda implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idComanda")
    private Integer idComanda;
    @Basic(optional = false)
    @Column(name = "Numero")
    private int numero;
    @Basic(optional = false)
    @Column(name = "fechaIngreso")
    @Temporal(TemporalType.DATE)
    private Date fechaIngreso;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "Tarjeta")
    private Float tarjeta;
    @Column(name = "Efectivo")
    private Float efectivo;
    @Column(name = "descuento")
    private Float descuento;
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @Column(name = "Total")
    private float total;
    @Column(name = "anulado")
    private Boolean anulado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comanda")
    private List<ComandaHasPlatillo> comandaHasPlatilloList;

    public Comanda() {
    }

    public Comanda(Integer idComanda) {
        this.idComanda = idComanda;
    }

    public Comanda(Integer idComanda, int numero, Date fechaIngreso, float total) {
        this.idComanda = idComanda;
        this.numero = numero;
        this.fechaIngreso = fechaIngreso;
        this.total = total;
    }

    public Integer getIdComanda() {
        return idComanda;
    }

    public void setIdComanda(Integer idComanda) {
        this.idComanda = idComanda;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public Date getFechaIngreso() {
        return fechaIngreso;
    }

    public void setFechaIngreso(Date fechaIngreso) {
        this.fechaIngreso = fechaIngreso;
    }

    public Float getTarjeta() {
        return tarjeta;
    }

    public void setTarjeta(Float tarjeta) {
        this.tarjeta = tarjeta;
    }

    public Float getEfectivo() {
        return efectivo;
    }

    public void setEfectivo(Float efectivo) {
        this.efectivo = efectivo;
    }

    public Float getDescuento() {
        return descuento;
    }

    public void setDescuento(Float descuento) {
        this.descuento = descuento;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public float getTotal() {
        return total;
    }

    public void setTotal(float total) {
        this.total = total;
    }

    public Boolean getAnulado() {
        return anulado;
    }

    public void setAnulado(Boolean anulado) {
        this.anulado = anulado;
    }

    @XmlTransient
    public List<ComandaHasPlatillo> getComandaHasPlatilloList() {
        return comandaHasPlatilloList;
    }

    public void setComandaHasPlatilloList(List<ComandaHasPlatillo> comandaHasPlatilloList) {
        this.comandaHasPlatilloList = comandaHasPlatilloList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idComanda != null ? idComanda.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Comanda)) {
            return false;
        }
        Comanda other = (Comanda) object;
        if ((this.idComanda == null && other.idComanda != null) || (this.idComanda != null && !this.idComanda.equals(other.idComanda))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidad.Comanda[ idComanda=" + idComanda + " ]";
    }
    
}
